package com.sky.service.impl;

import com.sky.domain.User;
import com.sky.mapper.UserMapper;
import com.sky.service.UserService;
import com.sky.utils.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 尹稳健~
 * @version 1.0
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    // MD加密
    @Override
    public User findByUsernameAndPassword(String username, String password) {
        return userMapper.findByUsernameAndPassword(username, MD5Utils.code(password));
    }

    @Override
    public User getUserInfo() {
        return userMapper.getUserInfo();
    }

    @Override
    public User getUser(Long id) {
        return userMapper.getUser(id);
    }

    @Override
    public void updateUserInfo(User user) {
        userMapper.updateUserInfo(user);
    }
}
